<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>yzm</title>
</head>
<body>
            <h1>Hello,验证码</h1>
    <input type="text" placeholder="请输入手机号" id="tel"/>
            <button onclick="sendCode()">发送验证码</button>
    <input type="text" onclick="checkCode()" placeholder="请输入验证码" id="code"/>
            <button>验证</button>
            <div id="div"></div>
        <script src="js/axios.js"></script>
    <script>

        function sendCode() {
            let tel = document.getElementById("tel").value;
            axios.get("/cendCode?tel=" + tel).then(response => {
            document.getElementById("div").innerHTML="你的验证码是"+response.data;
            })
        }
        function checkCode() {
            let code=document.getElementById("code").value;
            let tel = document.getElementById("tel").value;
            axios.get("/checkCode?tel="+tel+"code="+code).then(response => {

                if (resp.data==="code")

                    alert("验证成功");
                else
                    alert("验证失败");

        }
        );
        }
    </script>




</body>
</html>